<template>
  <el-card style="width: 840px; height: 480px ">
    <div id="echarts" style="width: 840px;height: 480px"></div>
  </el-card>

</template>

<script>

export default {
  name: "ClassifcationEcharts",
  props:{
    nameAndValue:[]
  },
  data() {
    return {
    }
  },
  created() {
    this.$nextTick(function (){
      let echartsInstance = this.$echarts.init(document.getElementById("echarts"))
      this.showEcharts(echartsInstance)
    })


  },
  methods:{

    showEcharts(echartsInstance){
      echartsInstance.setOption({

        title: {
          text: '水果种类识别计量表',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        color:['#6eb158', '#cdcdcd', '#3f8cff','#112134','#120492'],
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: this.nameAndValue,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      })
    }
  }
}
</script>

<style scoped>

</style>
